package com.aifund.common.entity;

import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

@Entity
@SQLDelete(sql = "update ai_user set delete = 1 where id = ?")
@Where(clause = "is_del = 0")
@Data
@EntityListeners(AuditingEntityListener.class)
public class AiUser {
    @Id
    @GeneratedValue
    private Long id;

    /**
     * 手机号
     */
    private String phone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 密码
     */
    private String aiPassword;

    /**
     * 用户等级{0: 普通用户  1：交易员}
     */
    private Integer userIndex;


    /**
     * 头像
     */
    private String header;

    /**
     * VIP级别
     */
    private Integer vipLever;

    /**
     * 昵称
     */
    private String nickName;

    /**
     * 生日
     */
    private String birthday;


    /**
     * 积分
     */
    private BigDecimal integration;


    /**
     * 邀请码
     */
    private String invitationCode;

    /**
     * 交易密码
     */
    private String payPassword;


    /**
     * 是否是第一次打开
     */
    private Boolean isFirstOpen = false;


    /**
     * 收款账号
     */
    private String receivingAccount;


    @CreatedDate
    @Column(name = "createTime",updatable = false,nullable = false)
    private Date createTime;

    @LastModifiedDate
    @Column(name = "updateTime",nullable = false)
    private Date updateTime;

    @Type(type = "org.hibernate.type.NumericBooleanType")
    private Boolean isDel = false;

}
